package eval.engine;

import java.util.List;
import java.util.Map;

import eval.engine.cplex.CplexMapIndexToVmId;
import eval.engine.cplex.InitialCplexCode.CplexDataHolder;
import eval.host.Host;
import eval.vm.VMIdentifier;
import eval.vm.VirtualMachine;

/**
 * Interface for a placement object. Each placement technique (e.g. CPLEX,
 * Heuristic) implement their own placement class
 * 
 * 
 * */
public interface IPlacement {
		
	//####### CLOUD #######
	
	//return the amount of cpu requested to be deployed in the cloud.includes the demand of rejected vms.
	public abstract int getTotalRequestedCPU();
	
	//return the value of current CPU load in the Cloud
	public abstract int getTotalCloudCPULoad();
	
	//return the value of current CPU demand in the cloud. 
	public abstract int getTotalCloudCpuDemand();
	
	//return the value of current MEMORY demand in the cloud. 
	public abstract int getTotalCloudMemDemand();
	
	//####### HOSTS #######
	
	// return a list of hosts that turned on in current placement.
	public abstract List<Host> getTurnedONHosts();
	
	// return a list of hosts that turned off in current placement.
	public abstract List<Host> getTurnedOFFHosts();
	
	//the loud of the host with the minimum cpu load.
	public abstract double getMinCPULoadInHosts();
	
	//the loud of the host with the minimum MEM load.
	public abstract double getMinMEMLoadInHosts();

	//return the average cpu load of all hosts => totalCPULoad / numberOfAllHost
	public abstract double getAvgCPULoadInHosts();
	
	//return the average memory load of all hosts.
	public abstract double getAvgMEMLoadInHosts();
	
	//return the load of the host with the maximum cpu load.
	public abstract double getMaxCPULoadInHosts();
	
	//the load of the host with the maximum MEM load.
	public abstract double getMaxMEMLoadInHosts();
	
	//return the number of open hosts.
	public abstract int getNumberOfOpenHosts();
	
	//return the number of closed hosts.
	public abstract int getNumberOfClosedHosts();
	
	//return the number of hosts that candidates for closing.  
	public abstract int getNumberOfCandidatesForClosingHosts();
	
	//return the number of vms that have been turned off during current placement.
	public abstract int getNumberOfTurnOffHosts();
	
	//return the number of vms that have been turned on during current placement.
	public abstract int getNumberOfTurnOnHosts();
	
	
	//####### VIRTUAL MACHINES #######

//	In the meantime,I comment this function,as this information can be collected from vmMaping.
//	//return a list of VMS deployed in the cloud.
//	public abstract List<VirtualMachine> getVMSinCloud();
	
	//return a list of VMS that request to be deployed in the cloud. includes rejected vms.
	public List<VirtualMachine> getVMSrequestedTobedeployed();
	
	//return a list of VMS in the cloud with Satisfied Demand.
	public List<VirtualMachine> getVMSWithSatisfiedDemand();
	
	//return a list of VMS in the cloud with unstisfied Demand. not include rejected vm's.  
	public List<VirtualMachine> getVMSWithUNSatisfiedDemand();
	
	//return a list of VMS that rejected from being deployed in the cloud.
	public List<VirtualMachine> getRejectedVMS();
	
	//return a list of VMS that been removed in current placement. 
	public List<VirtualMachine> getRemovedList();
	
	//return a list of VMS that have been placed in current placement. 
	public List<VirtualMachine> getPlacedList();
	
	//return the number of vms currently deploy in the cloud.
	public abstract int getNumberOfVMsAtCloud();
	
	//return the number of vms with satisfied demand.
	public abstract int getNumberOfVMsWithSatisfiedDemand();
	
	//return the number of vms with unsatisfied demand.
	public abstract int getNumberOfVMsWithUnSatisfiedDemand();

	//return the sum of the demand of all satisfied vms.
	public abstract int getTotalSatisfiedCPUDemand();
	
	//return the sum of the demand of all unsatisfied vms.
	public abstract int getTotalUnSatisfiedCPUDemand();

	//return the number of vms that have been removed during this placement.
	public abstract int getNumberOfRemovedVMs();
	
	//return the number of vm's deployed in current tick.
	public abstract int getNumberOfPlacedVMs();
	
	
	//####### PLACEMENT #######
	
	//return whether current placement is empty or not 
	public abstract boolean isEmptyPlacement();
	
	public  Map<Host, List<VirtualMachine>> getvmMapping();
	//TODO:optional - add functions that checks the CPU_DEMAND / MEM_DEMAND / CPU_LOAD / etc.. only for the vms deployed in current tick/placement.  
	
	public abstract boolean isHostOpen(Host host);
	
	public abstract boolean isHostClose(Host host);
	
	public abstract Host getHostFromLastPlacement(Host host);

	public Map<Integer, List<VMIdentifier>> getCloudMap();

	public List<Integer> getOpenHosts();

	public abstract int getNumberOfVmsReqToBeDeploy();

	public abstract int getTotalCpuCapcityAtOpenHosts();

	public abstract int getTotalCpuCapcityAtCloud();

	public abstract int getTotalMemCapcityAtOpenHosts();

	public abstract int getTotalCloudMemAtCloud();

	public abstract double getHostsStartUpCost();

	public abstract double getWorkingHostCost();

	public abstract double getIncomeForSatisfyDemand();

	public abstract int getTotalMemLoadAtCloud();

	public abstract double getBaseHostCost();

	public abstract int getVmRelocate();

	public abstract double getSumOfMinReservtion();

	public abstract CplexMapIndexToVmId getCplexMapIndexToVmId();

	public abstract CplexDataHolder getCplexData();



}